﻿using Digitalmes.Model;
using Digitalmes.Model.EquipmentManagement;
using Digitalmes.Model.ProcessManagement;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
using WalkingTec.Mvvm.Core;

namespace Digitalmes.Model.ProcessManagement
{
    /// <summary>
    /// ProcessParameter
    /// </summary>
	[Table("ProcessParameter")]

    [Display(Name = "_Model.ProcessParameter")]
    public class ProcessParameter : BasePoco,IPersistPoco,ITenant
    {
        [Display(Name = "_Model._ProcessParameter._SetValue")]
        [Comment("设定值")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string SetValue { get; set; }
        [Display(Name = "_Model._ProcessParameter._Precision")]
        [Comment("精度")]
      
        public int? Precision { get; set; } = 3;
        [Display(Name = "_Model._ProcessParameter._Route")]
        [Comment("工艺路线")]
        public ProcessRoute Route { get; set; }
        [Display(Name = "_Model._ProcessParameter._Route")]
        [Comment("工艺路线")]
        public long? RouteId { get; set; }
        [Display(Name = "_Model._ProcessParameter._Op")]
        [Comment("工序")]
        public ProcessRouteItem Op { get; set; }
        [Display(Name = "_Model._ProcessParameter._Op")]
        [Comment("工序")]
        public long? OpId { get; set; }
        [Display(Name = "_Model._ProcessParameter._TagId")]
        [Comment("变量")]
        public long? TagId { get; set; }

        public EquipmentTag Tag { get; set; }

        [Display(Name = "_Model._ProcessParameter._ParameterName")]
        [StringLength(255, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("参数名称")]
        public string ParameterName { get; set; }
        [Display(Name = "_Model._ProcessParameter._DataType")]
        [Comment("数据类型")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public TagDataTypeEnum? DataType { get; set; }
        [Display(Name = "_Model._ProcessParameter._Active")]
        [Comment("激活")]
        
        public bool Active { get; set; } = false;

        [Display(Name = "_Model._ProcessParameter._TagName")]
        [Comment("变量名称")]
        public string TagName { get; set; }
        [Display(Name = "_Model._ProcessParameter._ProductId")]
        [Comment("产品")]
        public long? ProductId { get; set; }
        [Display(Name = "_Model._ProcessParameter._EquipmentId")]
        [Comment("关联设备")]
        public long? EquipmentId { get; set; }
        [Display(Name = "_Model._ProcessParameter._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
